****************** Figure 1 ********************

* Use "jlc_replication_data.dta"

*Top-Left Pane*

 histogram total_6m, width(1) frequency normal
 
*Top-Right Pane*

graph bar (mean) total_6m, over(year_count) blabel(bar)

*Bottom-Left Pane*

graph bar (mean) total_6m, over(method) blabel(bar)

*Bottom-Right Pane (Switch datasets to "time_coverage_data.dta")*

twoway (line partisan period) (line nonpartisan period) (line hybrid period) (line retention period)

* Now switch back to "jlc_replication_data.dta". *  

****************** Table 1 ********************
 
sum ap6mr_case ap6mr_party ap6mr_announce ap6mr_pacs ap6mr_quals  ///
	ap6mr_campaign ap6mr_admin ap6mr_issues ap6mr_horse ap6mr_ideo  ///
	ap6mr_endorse ap6mr_mud ap6mr_scandal if partisan==1
	
sum ap6mr_case ap6mr_party ap6mr_announce ap6mr_pacs ap6mr_quals  ///
	ap6mr_campaign ap6mr_admin ap6mr_issues ap6mr_horse ap6mr_ideo  ///
	ap6mr_endorse ap6mr_mud ap6mr_scandal if nonpartisan==1
	
sum ap6mr_case ap6mr_party ap6mr_announce ap6mr_pacs ap6mr_quals  ///
	ap6mr_campaign ap6mr_admin ap6mr_issues ap6mr_horse ap6mr_ideo  ///
	ap6mr_endorse ap6mr_mud ap6mr_scandal if retention==1
	
sum ap6mr_case ap6mr_party ap6mr_announce ap6mr_pacs ap6mr_quals  ///
	ap6mr_campaign ap6mr_admin ap6mr_issues ap6mr_horse ap6mr_ideo  ///
	ap6mr_endorse ap6mr_mud ap6mr_scandal 
	
sum ap6mr_case_pct ap6mr_party_pct ap6mr_announce_pct ap6mr_pac_pct ///
	ap6mr_quals_pct	ap6mr_campaign_pct ap6mr_admin_pct ap6mr_issue_pct ///
	ap6mr_horse_pct ap6mr_ideo_pct ap6mr_endorse_pct ap6mr_mud_pct ///
	ap6mr_scandal_pct if partisan==1
	
sum ap6mr_case_pct ap6mr_party_pct ap6mr_announce_pct ap6mr_pac_pct ///
	ap6mr_quals_pct	ap6mr_campaign_pct ap6mr_admin_pct ap6mr_issue_pct ///
	ap6mr_horse_pct ap6mr_ideo_pct ap6mr_endorse_pct ap6mr_mud_pct ///
	ap6mr_scandal_pct if nonpartisan==1
	
sum ap6mr_case_pct ap6mr_party_pct ap6mr_announce_pct ap6mr_pac_pct ///
	ap6mr_quals_pct	ap6mr_campaign_pct ap6mr_admin_pct ap6mr_issue_pct ///
	ap6mr_horse_pct ap6mr_ideo_pct ap6mr_endorse_pct ap6mr_mud_pct ///
	ap6mr_scandal_pct if retention==1
	
sum ap6mr_case_pct ap6mr_party_pct ap6mr_announce_pct ap6mr_pac_pct ///
	ap6mr_quals_pct	ap6mr_campaign_pct ap6mr_admin_pct ap6mr_issue_pct ///
	ap6mr_horse_pct ap6mr_ideo_pct ap6mr_endorse_pct ap6mr_mud_pct ///
	ap6mr_scandal_pct 
	
****************** Table 2 ********************

pwcorr total_3m local_3m, sig
pwcorr total_36m local_36m, sig
pwcorr total_612m local_612m, sig

****************** Table 3 ********************

mixed  rolloff log_total_3m   professional ///
 district open_seat interim_appointed_seat   midterm primary female_ran minority_ran ///
 nonpartisan hybrid retention  i.year_count  if  rolloff>0 & ///
 year>2001   || court_id: 
 
mixed  rolloff log_total_6m   professional ///
 district open_seat interim_appointed_seat   midterm primary female_ran minority_ran ///
 nonpartisan hybrid retention  i.year_count  if  rolloff>0 & ///
 year>2001   || court_id: 

mixed  rolloff log_total_12m   professional ///
 district open_seat interim_appointed_seat   midterm primary female_ran minority_ran ///
 nonpartisan hybrid retention  i.year_count  if  rolloff>0 & ///
 year>2001   || court_id: 
  
mixed  rolloff log_total_3m  log_cm ///
log_attack log_promote log_contrast professional  district open_seat interim_appointed_seat   midterm ///
primary female_ran minority_ran nonpartisan  hybrid  i.year_count ///
  if retention==0 & number_can>1 & rolloff>0 & year>2001  || court_id: 
  
mixed  rolloff log_total_6m  log_cm ///
log_attack log_promote log_contrast professional  district open_seat interim_appointed_seat   midterm ///
primary female_ran minority_ran nonpartisan  hybrid  i.year_count ///
  if retention==0 & number_can>1 & rolloff>0 & year>2001  || court_id: 
  
mixed  rolloff log_total_12m  log_cm ///
log_attack log_promote log_contrast professional  district open_seat interim_appointed_seat   midterm ///
primary female_ran minority_ran nonpartisan  hybrid  i.year_count ///
  if retention==0 & number_can>1 & rolloff>0 & year>2001  || court_id: 
  
****************** Table 4 ********************

menbreg local_coverage_race_new  log_cm log_attack log_promote log_contrast  ///
	open_seat interim_appointed_seat   midterm ///
	primary female_ran minority_ran nonpartisan  hybrid retention i.year_count ///
	if rolloff>0 & year>2001 & partisan==1 || court_id:
	
menbreg local_coverage_race_new  log_cm log_attack log_promote log_contrast  ///
	professional  district open_seat interim_appointed_seat   midterm ///
	primary female_ran minority_ran nonpartisan  hybrid retention i.year_count ///
	if rolloff>0 & year>2001 & nonpartisan==1 | hybrid==1 || court_id:
	
menbreg local_coverage_race_new  log_cm log_attack log_promote log_contrast  ///
	professional  district open_seat interim_appointed_seat   midterm ///
	primary female_ran minority_ran nonpartisan  hybrid retention i.year_count ///
	if rolloff>0 & year>2001 & retention==1 || court_id:
	
menbreg local_coverage_race_new  log_cm log_attack log_promote log_contrast  ///
	professional  district open_seat interim_appointed_seat   midterm ///
	primary female_ran minority_ran nonpartisan  hybrid retention i.year_count ///
	if rolloff>0 & year>2001  || court_id:
  
****************** Table 5 ********************

mixed  rolloff log_total_12m log_cm log_attack log_promote  /// 
	opposed professional district  interim_appointed_seat midterm primary ///
    female_ran minority_ran i.year_count if  retention==1 & rolloff>0 &  ///
     state!="IL" & state!="MT" & state!="NM" || court_id:  ///
	 
mixed  rolloff log_total_12m log_cm log_attack log_promote  /// 
	lowest opposed  district  interim_appointed_seat midterm primary ///
    female_ran minority_ran i.year_count if  retention==1 & rolloff>0 &  ///
     state!="IL" & state!="MT" & state!="NM" || court_id:  ///
 
mixed  rolloff log_total_12m opposed   professional ///
 district  interim_appointed_seat   midterm primary female_ran minority_ran ///
    i.year_count if cm_seat_gen_mil_16_pc==0 &  retention==1 &  rolloff>0 &  ///
   total_race_ads==0  & state!="IL" & state!="MT" & state!="NM"  ///
   || court_id: 
 
 mixed  rolloff log_total_12m opposed lowest   ///
 district  interim_appointed_seat   midterm primary female_ran minority_ran ///
    i.year_count if cm_seat_gen_mil_16_pc==0 &  retention==1 &  rolloff>0 &  ///
   total_race_ads==0  & state!="IL" & state!="MT" & state!="NM"  ///
   || court_id: 
  
****************** Table 6 ********************

mixed  rolloff log_cases_6m log_party_6m log_announce_6m ///
	log_pac_6m log_quals_6m log_campaign_6m log_admin_6m log_issues_6m ///
	log_horse_6m log_ideo_6m log_endorse_6m log_mud_6m log_scandal_6m ///
	 district open_seat interim_appointed_seat   midterm ///
	primary female_ran minority_ran nonpartisan retention ///
	i.year_count  if  rolloff>0 & year>2001   || court_id: 
	
mixed  rolloff log_cases_6m log_party_6m log_announce_6m ///
	log_pac_6m log_quals_6m log_campaign_6m log_admin_6m log_issues_6m ///
	log_horse_6m log_ideo_6m log_endorse_6m log_mud_6m log_scandal_6m ///
	log_cm log_attack log_promote log_contrast  district ///
	open_seat interim_appointed_seat   midterm ///
	primary female_ran minority_ran nonpartisan   ///
	i.year_count  if  rolloff>0 & year>2001 & retention==0  || court_id: 
	
mixed  rolloff log_cases_6m log_party_6m log_announce_6m ///
	log_pac_6m log_quals_6m log_campaign_6m log_admin_6m log_issues_6m ///
	log_horse_6m log_ideo_6m log_endorse_6m log_cm log_attack log_promote ///
	district interim_appointed_seat midterm  female_ran minority_ran ///
	i.year_count  if  rolloff>0 & year>2001 & retention==01  || court_id: 
	
mixed  rolloff log_cases_6m log_party_6m log_announce_6m ///
	log_pac_6m log_quals_6m log_campaign_6m log_admin_6m log_issues_6m ///
	log_horse_6m log_ideo_6m log_endorse_6m log_mud_6m log_scandal_6m ///
	log_cm log_attack log_promote log_contrast   district ///
	open_seat interim_appointed_seat   midterm ///
	primary female_ran minority_ran nonpartisan retention  ///
	i.year_count  if  rolloff>0 & year>2001  || court_id: 
 
****************** Table A.1.1 ********************

sum rolloff  total_3m total_36m total_612m if state=="AL"
sum rolloff  total_3m total_36m total_612m if state=="AK"
sum rolloff  total_3m total_36m total_612m if state=="AR"
sum rolloff  total_3m total_36m total_612m if state=="AZ"
sum rolloff  total_3m total_36m total_612m if state=="CA"
sum rolloff  total_3m total_36m total_612m if state=="CO"
sum rolloff  total_3m total_36m total_612m if state=="FL"
sum rolloff  total_3m total_36m total_612m if state=="GA"
sum rolloff  total_3m total_36m total_612m if state=="ID"
sum rolloff  total_3m total_36m total_612m if state=="IL"
sum rolloff  total_3m total_36m total_612m if state=="IN"
sum rolloff  total_3m total_36m total_612m if state=="IA"
sum rolloff  total_3m total_36m total_612m if state=="KS"
sum rolloff  total_3m total_36m total_612m if state=="KY"
sum rolloff  total_3m total_36m total_612m if state=="LA"
sum rolloff  total_3m total_36m total_612m if state=="MI"
sum rolloff  total_3m total_36m total_612m if state=="MN"
sum rolloff  total_3m total_36m total_612m if state=="MO"
sum rolloff  total_3m total_36m total_612m if state=="MS"
sum rolloff  total_3m total_36m total_612m if state=="MT"
sum rolloff  total_3m total_36m total_612m if state=="NC"
sum rolloff  total_3m total_36m total_612m if state=="NE"
sum rolloff  total_3m total_36m total_612m if state=="NM"
sum rolloff  total_3m total_36m total_612m if state=="NV"
sum rolloff  total_3m total_36m total_612m if state=="OH"
sum rolloff  total_3m total_36m total_612m if state=="OKSC"
sum rolloff  total_3m total_36m total_612m if state=="OR"
sum rolloff  total_3m total_36m total_612m if state=="SD"
sum rolloff  total_3m total_36m total_612m if state=="TN"
sum rolloff  total_3m total_36m total_612m if state=="TXSC"
sum rolloff  total_3m total_36m total_612m if state=="UT"
sum rolloff  total_3m total_36m total_612m if state=="WA"
sum rolloff  total_3m total_36m total_612m if state=="WV"
sum rolloff  total_3m total_36m total_612m if state=="WY"
sum rolloff total_3m total_36m total_612m if rolloff>0 & year>2001


****************** Table A.3.1 ********************

sum rolloff log_total_3m log_total_6m log_total_12m log_cm log_attack ///
	log_promote log_contrast professional district open interim_ap ///
	midterm primary female_ran minority_ran opposed lowest ///
	partisan nonpartisan hybrid retention

